package com.xin.chainclick.controller;

import com.xin.chainclick.common.ResponseEntity;
import com.xin.chainclick.entity.ClickNewEntity;
import com.xin.chainclick.service.ClickNewEntityService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/clickNewEntity")
public class ClickNewEntityController {

    @Autowired
    ClickNewEntityService clickNewEntityService;

    @GetMapping("/getClickNewEntity/{name}")
    public ResponseEntity<List<ClickNewEntity>> selectCooperationEntities(@PathVariable String name){

        ResponseEntity<List<ClickNewEntity>> listResponseEntity = new ResponseEntity<>();

        List<ClickNewEntity> cooperationEntities = clickNewEntityService.selectClickNewEntities(name);

        listResponseEntity.setData(cooperationEntities);
        listResponseEntity.setCode(1);
        listResponseEntity.setMsg("获取成功");

        return listResponseEntity;
    }
}
